<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>bear</title>

    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background: url(images/star.jpeg) no-repeat;
            background-size: 100%;
        }

        .box {
            position: relative;
            bottom: 0;
            height: 600px;
        }

        .box .mountain,
        .box .snow {
            overflow: hidden;
            width: 100%;
        }

        .box .mountain {
            position: absolute;
            bottom: 0;
            height: 600px;
            background: url(images/bg2.png) repeat-x;
            animation: mountain 30s linear infinite;
        }

        .box .snow {
            position: absolute;
            bottom: 0;
            height: 336px;
            background: url(images/bg1.png) repeat-x;
            animation: mountain 10s linear infinite;
        }

        .box .bear {
            position: absolute;
            z-index: 1;
            bottom: 50px;
            width: 200px;
            height: 100px;
            background: url(images/bear.png) no-repeat;
            animation:
                run 0.5s steps(8) infinite,
                move 3s forwards;
        }

        @keyframes run {
            0% {
                background-position: 0 0;
            }

            100% {
                background-position: -1600px 0;
            }
        }

        @keyframes move {
            0% {
                left: 0;
            }

            100% {
                left: 50%;
                transform: translate(-50%);
            }
        }

        @keyframes mountain {
            0% {
                background-position: 0 0;
            }

            100% {
                background-position: -3840px 0;
            }
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="bear"></div>
        <div class="mountain"></div>
        <div class="snow"></div>
    </div>

</body>

</html>